package cn.mzboy.order.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class OrderController {

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/findOrder")
    public String create(String productId,String userId){
        String productName = restTemplate.getForObject("http://product/product-serv/findProductById/"+productId, String.class);
        String stockResult = restTemplate.getForObject("http://stock/stock-serv/operateStock/"+productId, String.class);
        return "product \n"+productName+"\n stock status: "+stockResult;
    }
}
